package com.xqb.modules.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;

/**
 * 选择题表
 *
 * @author 赵鹏宇
 * @TableName exa_question_detail
 */
@TableName(value = "exa_question_detail")
@Data
public class ExaQuestionDetail implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    /**
     * 题目id
     */
    @TableId
    private Long id;
    /**
     * 选择题选项，json数组格式
     */
    private Object options;
    /**
     * 正确答案(选择题1代表A，2代表B，如果有多个答案，中间使用逗号隔开，如果是判断题，1：代表正确，0代表错误）
     */
    private String answer;
    /**
     * 答案解析
     */
    private String analysis;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ExaQuestionDetail other = (ExaQuestionDetail) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getOptions() == null ? other.getOptions() == null : this.getOptions().equals(other.getOptions()))
                && (this.getAnswer() == null ? other.getAnswer() == null : this.getAnswer().equals(other.getAnswer()))
                && (this.getAnalysis() == null ? other.getAnalysis() == null : this.getAnalysis().equals(other.getAnalysis()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getOptions() == null) ? 0 : getOptions().hashCode());
        result = prime * result + ((getAnswer() == null) ? 0 : getAnswer().hashCode());
        result = prime * result + ((getAnalysis() == null) ? 0 : getAnalysis().hashCode());
        return result;
    }

    @Override
    public String toString() {
        String sb = getClass().getSimpleName() +
                " [" +
                "Hash = " + hashCode() +
                ", id=" + id +
                ", options=" + options +
                ", answer=" + answer +
                ", analysis=" + analysis +
                ", serialVersionUID=" + serialVersionUID +
                "]";
        return sb;
    }
}